<?php
/**
 * Created by litong on Date: 2019/2/24 0024 下午 9:21
 */
$host="localhost";$username="root";$password="";$dbname="php_study";
$connection = new mysqli($host, $username, $password, $dbname);
if($connection->connect_error){
  echo $connection->connect_error.PHP_EOL;
}
$sql = "INSERT INTO my_guests (firstname, lastname, email) VALUES ('John', 'Doe', 'john@example.com')";
if($connection->query($sql)){
  echo "执行成功";
}else{
  echo $connection->error.PHP_EOL;
}